﻿using System;
using System.Data;
using ET;
using Ext.Net;
using BLL;
using Roles;

namespace ERP.Modules
{
    public partial class Inventory : System.Web.UI.UserControl
    {
        private readonly Inventory_BLL clsInventory = new Inventory_BLL();
        private readonly Warehouse_BLL _clsWarehouse = new Warehouse_BLL();
        private readonly Room_BLL _clsRoom = new Room_BLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                CheckPermisstion();
                GetData();
                GetRoom();
                GetWarehouse();
                GetComboBox();
                ClearTextBox();
                WindowsBranch();
                WindowsWarehouse();
                WindowsRoom();
            }
        }
        //-------Store-Datasource-----------------
        protected void StoreInventory_RefreshData(object sender, StoreReadDataEventArgs e)
        {
            txtSearch.Text = string.Empty;
            txtDateBeginFillter.Text = string.Empty;
            txtDateEndFillter.Text = string.Empty;
            SelectBoxInventoryWarrehouse.Text = string.Empty;
            SelectBoxInventoryRoom.Text = string.Empty;
            GetData();
            GetRoom();
            GetWarehouse();
        }
        protected void StoreInventory_Detail_RefreshData(object sender, StoreReadDataEventArgs e)
        {

        }
        //--------Buttom-Main------------------------
        protected void btnAddNew_Click(object sender, DirectEventArgs e)
        {
            ClearTextBox();
            WindowsInventory.Show();
        }
        protected void btnEdit_Click(object sender, DirectEventArgs e)
        {
            var sm = grInventory.GetSelectionModel() as CheckboxSelectionModel;
            if (sm != null)
                foreach (SelectedRow row in sm.SelectedRows)
                {
                    ClearTextBox();
                    DataDetail(int.Parse(row.RecordID));
                    GetInventory_Materials(int.Parse(row.RecordID));
                    WindowsInventory.Show();
                    sm.UpdateSelection();
                }
        }
        protected void btnDel_Click(object sender, DirectEventArgs e)
        {
            var sm = grInventory.GetSelectionModel() as CheckboxSelectionModel;
            if (sm != null)
                foreach (SelectedRow row in sm.SelectedRows)
                {
                    try
                    {
                        Inventory_BLL.Deletetb_Inventory(int.Parse(row.RecordID));
                    }
                    catch (Exception)
                    {
                        HTML.clsFormat.Alert_ERROR("Thông Báo", "Tồn tại tài liệu con, không xoá được vui lòng xoá tài liệu con trước !");
                    }
                }
            GetData();
        }
        protected void btnFillter_Click(object sender, DirectEventArgs e)
        {
            GetInventoryFillterDate();
        }
        protected void SelectBoxInventoryWarrehouse_Change(object sender, DirectEventArgs e)
        {
            SelectBoxInventoryRoom.Text = string.Empty;
            GetData();
        }
        protected void SelectBoxInventoryRoom_Change(object sender, DirectEventArgs e)
        {
            SelectBoxInventoryWarrehouse.Text = string.Empty;
            GetData();
        }
        //--------Buttom-Popup------------------------
        protected void btnSavePopUp_Click(object sender, DirectEventArgs e)
        {
            if (txtInventory_ID.Text == string.Empty)
            {
                try
                {
                    if (!CheckInsert())
                    {
                        var GetInventory_Detail = e.ExtraParams["grInventory_Detail"];

                        var dtInventory_Detail = JSON.Deserialize<DataTable>(GetInventory_Detail);

                        if (dtInventory_Detail.Rows.Count == 0)
                        {
                            HTML.clsFormat.Alert_ERROR("Thông Báo", "Vui lòng thêm sản phẩm để nhập kho !");
                        }
                        else
                        {
                            var obj = new Inventory_ET
                            {
                                Inventory_No = txtInventory_No.Text,
                                Inventory_Date = DateTime.Parse(txtInventory_Date.Text),
                                Room_ID = cbRoom.SelectedItem.Value != null ? int.Parse(cbRoom.SelectedItem.Value) : (int?)null,
                                Warehouse_ID = int.Parse(cbWarehouse.SelectedItem.Value),
                                Inventory_Note = txtInventory_Note.Text,
                                Inventory_Test = txtInventory_Test.Text,
                                Inventory_Date_Add = DateTime.Now,
                                Inventory_Computer_Add = Environment.MachineName
                            };
                            var insert = Inventory_BLL.Inserttb_Inventory(obj);
                            if (insert)
                            {
                                foreach (DataRow rows in dtInventory_Detail.Rows)
                                {
                                    var Inventory_Detail = new Inventory_Detail_ET
                                    {
                                        Inventory_ID = obj.Inventory_ID,
                                        Materials_ID = int.Parse(rows["Materials_ID"].ToString()),
                                        Inventory_Detail_Quality_Voucher = int.Parse(rows["Inventory_Detail_Quality_Voucher"].ToString()),
                                        Inventory_Detail_Quality_HaveInventory = int.Parse(rows["Inventory_Detail_Quality_Insert"].ToString()),
                                        Inventory_Detail_Quality = 0,
                                        Inventory_Detail_Price = int.Parse(rows["Inventory_Detail_Price"].ToString())
                                    };
                                    Inventory_Detail_BLL.Inserttb_Inventory_Detail(Inventory_Detail);
                                }
                                HTML.clsFormat.Alert_INFO("Thông Báo", "Thêm mới thành công !");
                                grInventory_Detail.GetStore().RemoveAll();
                                GetData();
                                ClearTextBox();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    HTML.clsFormat.Alert_ERROR("Lỗi", ex.Message);
                }
            }
            else
            {
                if (CheckPermisstionDobclick())
                {
                    HTML.clsFormat.Alert_ERROR("Thông Báo", "Bạn không được cấp quyền để sửa đổi !");
                }
                else
                {
                    try
                    {
                        if (!CheckInsert())
                        {
                            var GetInventory_Detail = e.ExtraParams["grInventory_Detail"];

                            var dtInventory_Detail = JSON.Deserialize<DataTable>(GetInventory_Detail);

                            if (dtInventory_Detail.Rows.Count == 0)
                            {
                                HTML.clsFormat.Alert_ERROR("Thông Báo", "Vui lòng thêm sản phẩm để nhập kho !");
                            }
                            else
                            {
                                var obj = new Inventory_ET
                                {
                                    Inventory_ID = int.Parse(txtInventory_ID.Text),
                                    Inventory_No = txtInventory_No.Text,
                                    Inventory_Date = DateTime.Parse(txtInventory_Date.Text),
                                    Room_ID = cbRoom.SelectedItem.Value != null ? int.Parse(cbRoom.SelectedItem.Value) : (int?)null,
                                    Warehouse_ID = int.Parse(cbWarehouse.SelectedItem.Value),
                                    Inventory_Note = txtInventory_Note.Text,
                                    Inventory_Test = txtInventory_Test.Text,
                                    Inventory_Date_Modify = DateTime.Now,
                                    Inventory_Computer_Modify = Environment.MachineName
                                };
                                bool update = Inventory_BLL.Updatetb_Inventory(obj);
                                if (update)
                                {
                                    Inventory_Detail_BLL.Deletetb_Inventory_Detail_Default_ID(int.Parse(txtInventory_ID.Text));
                                    foreach (DataRow rows in dtInventory_Detail.Rows)
                                    {
                                        var Inventory_Detail = new Inventory_Detail_ET
                                        {
                                            Inventory_ID = int.Parse(txtInventory_ID.Text),
                                            Materials_ID = int.Parse(rows["Materials_ID"].ToString()),
                                            Inventory_Detail_Quality_Voucher = int.Parse(rows["Inventory_Detail_Quality_Voucher"].ToString()),
                                            Inventory_Detail_Quality_HaveInventory = int.Parse(rows["Inventory_Detail_Quality_HaveInventory"].ToString()) + int.Parse(rows["Inventory_Detail_Quality_Insert"].ToString()),
                                            Inventory_Detail_Quality = 0,
                                            Inventory_Detail_Price = int.Parse(rows["Inventory_Detail_Price"].ToString())
                                        };
                                        Inventory_Detail_BLL.Inserttb_Inventory_Detail(Inventory_Detail);
                                    }
                                    WindowsInventory.Close();
                                    HTML.clsFormat.Alert_INFO("Thông Báo", "Sữa thành công!");
                                    GetData();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        HTML.clsFormat.Alert_ERROR("Lỗi", ex.ToString());
                    }
                }
            }
        }
        protected void btnCancelPopUp_Click(object sender, DirectEventArgs e)
        {
            WindowsInventory.Close();
        }
        protected void btnAddInventoryMaterials_Click(object sender, DirectEventArgs e)
        {
            StoreInventory_Materials.Reload();
            WindowInventory_Materials.Show();
        }
        //----------Click-------------------
        protected void Cell_Click(object sender, DirectEventArgs e)
        {

        }
        protected void InventoryDblClick(object sender, DirectEventArgs e)
        {
            ClearTextBox();
            int Inventory_Id = int.Parse(e.ExtraParams["Inventory_ID"]);
            DataDetail(Inventory_Id);
            GetInventory_Materials(Inventory_Id);
            WindowsInventory.Show();
        }
        protected void UpdateMaterials_Click(object sender, DirectEventArgs e)
        {

        }
        //----------Button-Windows---------------
        #region[Method]
        protected void GetData()
        {
            if (String.IsNullOrEmpty(SelectBoxInventoryRoom.Text) && String.IsNullOrEmpty(SelectBoxInventoryWarrehouse.Text))
            {
                DataTable dtInventory = clsInventory.BindGirdtb_Inventory(string.Empty);
                if (dtInventory != null && dtInventory.Rows.Count > 0)
                {
                    StoreInventory.DataSource = dtInventory;
                    StoreInventory.DataBind();
                }
                else
                {
                    grInventory.GetStore().RemoveAll();
                }
            }
            else
            {
                DataTable dtInventory = clsInventory.GetInventoryFillter(SelectBoxInventoryWarrehouse.SelectedItem.Value,
                    SelectBoxInventoryRoom.SelectedItem.Value);
                if (dtInventory != null && dtInventory.Rows.Count > 0)
                {
                    StoreInventory.DataSource = dtInventory;
                    StoreInventory.DataBind();
                }
                else
                {
                    grInventory.GetStore().RemoveAll();
                }
            }
        }
        private void GetInventoryFillterDate()
        {
            if (String.IsNullOrEmpty(txtDateBeginFillter.Text) && String.IsNullOrEmpty(txtDateEndFillter.Text))
            {
                DataTable dtInventory = clsInventory.BindGirdtb_Inventory(string.Empty);
                if (dtInventory != null && dtInventory.Rows.Count > 0)
                {
                    StoreInventory.DataSource = dtInventory;
                    StoreInventory.DataBind();
                }
                else
                {
                    grInventory.GetStore().RemoveAll();
                }
            }
            else
            {
                DataTable dtInventory = clsInventory.GetInventoryFillterDate(txtDateBeginFillter.Text, txtDateEndFillter.Text);
                if (dtInventory != null && dtInventory.Rows.Count > 0)
                {
                    StoreInventory.DataSource = dtInventory;
                    StoreInventory.DataBind();
                }
                else
                {
                    grInventory.GetStore().RemoveAll();
                }
            }
        }
        protected void GetInventory_Materials(int id)
        {
            var clsInventory_Materials = new Inventory_Detail_BLL();
            DataTable dtInventory_Materials = clsInventory_Materials.BindGirdtb_Inventory_Materials(id);
                StoreInventory_Detail.DataSource = dtInventory_Materials;
                StoreInventory_Detail.DataBind();
        }
        protected void DataDetail(int id)
        {
            DataTable dtInventory = clsInventory.BindGirdtb_InventoryDetail(id);
            if (dtInventory != null && dtInventory.Rows.Count > 0)
            {
                cbBranch.SetValue(int.Parse(dtInventory.Rows[0]["Branch_Id"].ToString()));
                cbWarehouse.SetValue(int.Parse(dtInventory.Rows[0]["Warehouse_Id"].ToString()));
                if (String.IsNullOrEmpty(dtInventory.Rows[0]["Room_ID"].ToString()) == false)
                {
                    cbRoom.SetValue(int.Parse(dtInventory.Rows[0]["Room_ID"].ToString()));
                }
                txtInventory_ID.Text = dtInventory.Rows[0]["Inventory_ID"].ToString();
                txtInventory_No.Text = dtInventory.Rows[0]["Inventory_No"].ToString();
                txtInventory_Date.Text = dtInventory.Rows[0]["Inventory_Date"].ToString();
                txtInventory_Test.Text = dtInventory.Rows[0]["Inventory_Test"].ToString();
                txtInventory_Note.Text = dtInventory.Rows[0]["Inventory_Note"].ToString();
            }
        }
        protected bool CheckInsert()
        {
            bool kiemtra = false;
            var Inventory = new Inventory_BLL();
            var dtInventory = Inventory.BindGirdtb_Inventory(string.Empty);
            if (dtInventory != null && dtInventory.Rows.Count > 0)
            {
                foreach (DataRow dr in dtInventory.Rows)
                {
                    if (txtInventory_ID.Text != dr["Inventory_ID"].ToString())
                    {
                        if (txtInventory_No.Text == dr["Inventory_No"].ToString())
                        {
                            kiemtra = true;
                            HTML.clsFormat.Alert_ERROR("Thông Báo", "Mã nhập kho đã tồn tại !");
                        }
                    }
                }
            }
            return kiemtra;
        }
        private void GetWarehouse()
        {
            var _dtWarehouse = _clsWarehouse.GetWarehouse();
            if (_dtWarehouse != null && _dtWarehouse.Rows.Count > 0)
            {
                StoreInventoryWarrehouse.DataSource = _dtWarehouse;
                StoreInventoryWarrehouse.DataBind();
            }
            else
            {
                SelectBoxInventoryWarrehouse.GetStore().RemoveAll();
            }
        }
        private void GetRoom()
        {
            var _dtRoom = _clsRoom.GetRoom(string.Empty);
            if (_dtRoom != null && _dtRoom.Rows.Count > 0)
            {
                StoreInventoryRoom.DataSource = _dtRoom;
                StoreInventoryRoom.DataBind();
            }
            else
            {
                SelectBoxInventoryRoom.GetStore().RemoveAll();
            }
        }
        #endregion
        #region [ComboBox]

        protected void GetComboBox()
        {
            var clsBranch = new Branch_BLL();
            DataTable dtBranch = clsBranch.Search(string.Empty);
            if (dtBranch != null && dtBranch.Rows.Count > 0)
            {
                BranchStore.DataSource = dtBranch;
                BranchStore.DataBind();
            }

            var clsWarehouse = new Warehouse_BLL();
            DataTable dtWarehouse = clsWarehouse.Search(string.Empty);
            if (dtWarehouse != null && dtWarehouse.Rows.Count > 0)
            {
                WarehouseStore.DataSource = dtWarehouse;
                WarehouseStore.DataBind();
            }

            var clsRoom = new Room_BLL();
            DataTable dtRoom = clsRoom.Search(string.Empty);
            if (dtRoom != null && dtRoom.Rows.Count > 0)
            {
                RoomStore.DataSource = dtRoom;
                RoomStore.DataBind();
            }
        }

        protected void BranchSelectIndex_Change(object sender, StoreReadDataEventArgs e)
        {
            cbWarehouse.ReadOnly = false;
            var clsKho = new Warehouse_BLL();
            if (cbBranch.SelectedItem.Value != null)
            {
                DataTable dtKho = clsKho.GetWarehouseBranch(int.Parse(cbBranch.SelectedItem.Value));
                if (dtKho != null && dtKho.Rows.Count > 0)
                {
                    WarehouseStore.DataSource = dtKho;
                    WarehouseStore.DataBind();
                }
                else
                {
                    cbBranch.Clear();
                    cbWarehouse.ReadOnly = true;
                    HTML.clsFormat.Alert_INFO("Thông báo", "Chi nhánh này không có kho vui lòng chọn chi nhánh khác !");
                }
            }
            else
            {
                cbBranch.Clear();
                cbWarehouse.ReadOnly = true;
                HTML.clsFormat.Alert_INFO("Thông báo", "Vui lòng chọn chi nhánh !");
            }
        }
        protected void WarehouseSelectIndex_Change(object sender, StoreReadDataEventArgs e)
        {
            cbRoom.ReadOnly = false;
            var clsRoom = new Room_BLL();
            if (cbWarehouse.SelectedItem.Value != null)
            {
                DataTable dtRoom = clsRoom.GetRoomWareHouse(int.Parse(cbWarehouse.SelectedItem.Value));
                if (dtRoom != null && dtRoom.Rows.Count > 0)
                {
                    RoomStore.DataSource = dtRoom;
                    RoomStore.DataBind();
                }
                else
                {
                    cbWarehouse.Clear();
                    cbRoom.ReadOnly = true;
                    HTML.clsFormat.Alert_INFO("Thông báo", "Kho này không có phòng chứa vui lòng chọn kho khác !");
                }
            }
            else
            {
                cbWarehouse.Clear();
                cbRoom.ReadOnly = true;
                HTML.clsFormat.Alert_INFO("Thông báo", "Vui lòng chọn kho !");
            }
        }

        protected void ReloadComboBox(object sender, StoreReadDataEventArgs e)
        {
            GetComboBox();
        }

        #endregion
        #region[ClearTextbox]
        protected void ClearTextBox()
        {
            FormPanelInventory.Reset();

            txtInventory_ID.Text = string.Empty;
            txtInventory_No.Text = MaTuDong();
            txtInventory_Date.Text = DateTime.Now.ToString();
        }
        #endregion
        #region[MaTangTuDong]
        protected string MaTuDong()
        {
            int i;
            DataTable dt = clsInventory.BindGirdtb_Inventory(string.Empty);
            if (dt != null && dt.Rows.Count > 0)
            {
                int max = int.Parse(dt.Rows[0]["Inventory_ID"].ToString());
                for (i = 0; i < dt.Rows.Count; i++)
                {
                    if (int.Parse(dt.Rows[i]["Inventory_ID"].ToString()) > max)
                    {
                        max = int.Parse(dt.Rows[i]["Inventory_ID"].ToString());
                    }
                }
                i = max + 1;
            }
            else
            {
                i = 0;
            }
            return "NH_00" + i;
        }
        #endregion
        #region[Search]
        protected void Search_Event(object sender, DirectEventArgs e)
        {
            DataTable dtInventory = clsInventory.BindGirdtb_Inventory(txtSearch.Text);
            if (dtInventory != null && dtInventory.Rows.Count > 0)
            {
                StoreInventory.DataSource = dtInventory;
                StoreInventory.DataBind();
            }
        }
        #endregion
        #region [Materials]
        protected void GetMaterials()
        {
            var materials = new Materials_BLL();
            var dtGetMaterialProposed = materials.GetMaterials();
            StoreInventory_Materials.DataSource = dtGetMaterialProposed;
            StoreInventory_Materials.DataBind();
        }
        protected void btnSelectInventory_Materials_Click(object sender, DirectEventArgs e)
        {
            var GetInventory_Materials = e.ExtraParams["grInventory_Materials"];
            var GetInventory_Detail = e.ExtraParams["grInventory_Detail"];

            var dtInventory_Materials = JSON.Deserialize<DataTable>(GetInventory_Materials);
            var dtInventory_Detail = JSON.Deserialize<DataTable>(GetInventory_Detail);

            foreach (DataRow rows in dtInventory_Materials.Rows)
            {
                var insert = new Inventory_Detail_ET
                {
                    Inventory_ID = -1,
                    Materials_ID = int.Parse(rows["Materials_Id"].ToString()),
                    Materials_Alias = rows["Materials_Alias"].ToString(),
                    Materials_Name = rows["Materials_Name"].ToString(),
                    Unit_Name = rows["Unit_Name"].ToString(),
                    Inventory_Detail_Quality_Voucher = 0,
                    Inventory_Detail_Quality_HaveInventory = 0,
                    Inventory_Detail_Quality_Still = 0,
                    Inventory_Detail_Quality = 0,
                    Inventory_Detail_Quality_Insert = 0,
                    Inventory_Detail_Price = float.Parse(rows["Price_Initially"].ToString())
                };
                var kt = true;
                if (dtInventory_Detail != null && dtInventory_Detail.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtInventory_Detail.Rows)
                    {
                        if (insert.Materials_ID.ToString() == dr["Materials_Id"].ToString())
                        {
                            kt = false;
                            HTML.clsFormat.Alert_ERROR("Thông Báo", "Sản phẩm đã tồn tại, vui lòng cập nhật số lượng !");
                        }
                    }
                }
                if (kt)
                {
                    StoreInventory_Detail.Add(insert);
                    HTML.clsFormat.Alert_INFO("Thông báo", "Thêm sản phẩm thành công !");
                    WindowInventory_Materials.Hide();
                    CheckboxSelectionModel2.ClearSelection();
                }
            }
        }
        protected void cbProposedSelectIndex_Change(object sender, DirectEventArgs e)
        {
            GetMaterials();
        }

        protected void StoreInventory_Materials_RefreshData(object sender, StoreReadDataEventArgs e)
        {
            GetMaterials();
        }
        #endregion
        #region[Permisstion]
        private void CheckPermisstion()
        {
            if (Session["login"] != null && Session["USer_Detail_Id"].ToString() != string.Empty)
            {
                bool Is_BtnAdd;
                bool Is_BtnEdit;
                bool Is_BtnView;
                bool Is_BtnDel;
                bool Is_BtnPrint;
                bool Is_BtnCancel;
                bool Is_BtnReview;

                SecurityServices.HasPermisstion_Btn(StringContent.Inventory, out Is_BtnAdd, out Is_BtnEdit, out Is_BtnDel, out Is_BtnView, out Is_BtnCancel, out Is_BtnPrint, out Is_BtnReview);
                if (Is_BtnAdd == false)
                {
                    btnAddNew.Visible = false;
                }
                if (Is_BtnEdit == false)
                {
                    btnEdit.Visible = false;
                }
                if (Is_BtnView == false)
                {
                    PanelInventory.Visible = false;
                }
                if (Is_BtnDel == false)
                {
                    btnDel.Visible = false;
                }
                if (Is_BtnPrint == false)
                {
                    btnExport.Visible = false;
                }
            }
        }
        private bool CheckPermisstionDobclick()
        {
            var check = false;
            if (Session["login"] != null && Session["USer_Detail_Id"].ToString() != string.Empty)
            {
                bool Is_BtnAdd;
                bool Is_BtnEdit;
                bool Is_BtnView;
                bool Is_BtnDel;
                bool Is_BtnPrint;
                bool Is_BtnCancel;
                bool Is_BtnReview;

                SecurityServices.HasPermisstion_Btn(StringContent.Inventory, out Is_BtnAdd, out Is_BtnEdit, out Is_BtnDel, out Is_BtnView, out Is_BtnCancel, out Is_BtnPrint, out Is_BtnReview);
                if (Is_BtnEdit == false)
                {
                    check = true;
                }
            }
            return check;
        }
        #endregion

        private void WindowsBranch()
        {
            Window win = new Window()
            {
                ID = "WindowsBranch",
                Title = "Chi nhánh",
                Width = 829,
                Height = 400,
                Modal = true,
                AutoRender = false,
                Collapsible = false,
                Maximizable = true,
                Hidden = true,
                Loader = new ComponentLoader
                {
                    Url = "../PageParrent/Branch.aspx",
                    Mode = LoadMode.Frame,
                    LoadMask =
                    {
                        ShowMask = true
                    }
                }
            };
            this.Controls.Add(win);
        }
        private void WindowsWarehouse()
        {
            Window win = new Window()
            {
                ID = "WindowsWarehouse",
                Title = "Kho",
                Width = 829,
                Height = 400,
                Modal = true,
                AutoRender = false,
                Collapsible = false,
                Maximizable = true,
                Hidden = true,
                Loader = new ComponentLoader
                {
                    Url = "../PageParrent/Warehouse.aspx",
                    Mode = LoadMode.Frame,
                    LoadMask =
                    {
                        ShowMask = true
                    }
                }
            };
            this.Controls.Add(win);
        }
        private void WindowsRoom()
        {
            Window win = new Window()
            {
                ID = "WindowsRoom",
                Title = "Phòng chứa",
                Width = 829,
                Height = 400,
                Modal = true,
                AutoRender = false,
                Collapsible = false,
                Maximizable = true,
                Hidden = true,
                Loader = new ComponentLoader
                {
                    Url = "../PageParrent/Room.aspx",
                    Mode = LoadMode.Frame,
                    LoadMask =
                    {
                        ShowMask = true
                    }
                }
            };
            this.Controls.Add(win);
        }
    }
}